export default {
	props: {
		// 是否显示
		show: Boolean,
		// 关闭时间，毫秒
		time: {
			type: Number,
			default: 2000
		}
	},
	data() {
		return {
			value: this.show
		}
	},
	watch: {
		show: {
			handler(n) {
				this.value = this.show;
				this.close();
			},
			deep: true
		},
	},
	created() {
		this.close();
	},
	methods: {
		close() {
			if (this.value) {
				setTimeout(() => {
					this.value = false;
					// this.$emit("input", false);
					this.$emit('update:show', this.value);
				}, this.time)
			}
		}
	}
}